/*
 * @Author: huyuhang
 * @Data:
 * @LastEditors: huyuhang
 * @LastEditTime: 2024-04-07 10:19:05
 * @Description: 写点儿注释
 */
import request from '@/config/axios'

export const saveTask = async (data) => {
  return await request.postOriginal({ url: '/amp/asset-task/create-scan', data })
}

export const editTask = async (data) => {
  return await request.postOriginal({ url: '/amp/asset-task/update-scan', data })
}

export const getTaskDetail = async (params) => {
  return await request.get({ url: '/amp/asset-task/get-scan', params })
}

// 资产类型枚举
export const getAssetTypeEnum = async () => {
  return await request.get({ url: '/amp/asset-task/asset-type' })
}

// 获取配置
export const getConnectConfig = async () => {
  return await request.get({ url: '/amp/asset-task/connection-config' })
}

// 验证
export const dbVerify = async (data) => {
  return await request.post({ url: '/amp/asset-task/connect-test', timeout: 15000, data })
}

export const collectAllOverview = async (params) => {
  return await request.get({ url: '/amp/collection-result/overview', params })
}

export const collectList = (data) => {
  return request.postOriginal({ url: '/amp/collection-result/page', data })
}

export const collectTaskList = (params) => {
  return request.getOriginal({ url: '/amp/collection-asset/page', params })
}

// 获取数据库-schema-table 列表信息
export const getMetaInfoPage = (data) => {
  return request.postOriginal({ url: '/amp/asset-task/meta-info', data })
}

export const getCollectHistory = (params) => {
  return request.get({ url: '/amp/collection-result/asset-history', params })
}

//资产任务扫描数据
export const scanData = (data) => {
  return request.postOriginal({ url: '/amp/asset-task/scan-meta', data })
}

// 扫描数据进度
export const scanDataProgress = (data) => {
  return request.post({ url: '/amp/asset-task/scan-meta-progress', data })
}

// 单条数据采集结果-左侧树图
export const getMeta = (data) => {
  return request.post({ url: '/amp/collection-result/db-tree', data })
}

// 单条数据采集结果-树图详情（table）
export const getMetaChild = (data) => {
  return request.post({ url: '/amp/collection-result/column-list', data })
}

// 单条数据采集结果-树图详情（db、schema）
export const getTablePage = (data) => {
  return request.postOriginal({ url: '/amp/collection-result/table-page', data })
}

//数据采集任务查看结果导出
export const exportCollectResult = (data) => {
  return request.postOriginal({
    url: '/amp/collection-result/export',
    responseType: 'blob',
    data: data
  })
}

export const batchNumInfo = (data) => {
  return request.postOriginal({
    url: '/amp/asset-task/batch-num-info',
    data: data
  })
}

export const enginePingList = (data) => {
  return request.postOriginal({
    url: '/amp/asset-task/network-test',
    data
  })
}
